Efficient Register Allocation for Large Basic Blocks
نویسندگان
چکیده
We consider the NP{complete problem of generating evaluations for expression DAGs with a minimalnumber of registers. We restrict our attention to contiguous evaluations, because for nearly all of the DAGs derived from real application programs there exists a contiguous evaluation that is optimal w.r. to the register need. We present an algorithm that generates an optimal contiguous evaluation for a given DAG. The algorithm is very fast on the average. It generates the evaluation by splitting the DAG in trees with import and export nodes and applying a labeling scheme to the trees. A contiguous evaluation of an expression DAG is the sequence of the DAG nodes in the order of a postorder traversal of the DAG such that at each binary node, one subDAG is traversed completely before traversing the rest of the other subDAG. A tree node is either a leaf, or an inner node with all its sons being tree nodes and none of them having more than one father. A decision node is a binary node which is not a tree node. If we evaluate all the tree nodes in a DAG with d decision nodes by the Labeling Algorithm of Sethi/Ullman, there remain at most 2 d diierent contiguous evaluations for the DAG: (1) algorithm simple (2) Let v 1 ; : : :; v d be the decision nodes of the DAG, and (3) let = (1 ; : : :; d) 2 f0; 1g d be a bitvector. (4) forall 2 d diierent 2 f0; 1g d do (5) start dfs(root) with each , such that for 1 i d (6)
منابع مشابه
Low energy register allocation beyond basic blocks
An approach of doing register allocation beyond basic blocks for low energy is presented in this paper. With careful analysis of boundary conditions between consecutive blocks, our approach achieves the allocation results benefiting the whole program. By allowing the allocation results to propagate down block by block without backtracking, we avoid excessive computational cost.
متن کاملConstraint Programming Techniques for Optimal Instruction Scheduling
Modern processors have multiple pipelined functional units and can issue more than one instruction per clock cycle. This puts great pressure on the instruction scheduling phase in a compiler to expose maximum instruction level parallelism. Basic blocks and superblocks are commonly used regions of code in a program for instruction scheduling. Instruction scheduling coupled with register allocati...
متن کاملEvaluation of Algorithms for Local Register Allocation
Local register allocation (LRA) assigns pseudo-registers to actual registers in a basic block so as to minimize the spill cost. In this paper, four different LRA algorithms are compared with respect to the quality of their generated allocations and the execution times of the algorithms themselves. The evaluation is based on a framework that views register allocation as the combination of bounda...
متن کاملA Randomized Heuristic Approach to Register Allocation
We present a randomized algorithm to generate contiguous evaluations for expression DAGs representing basic blocks of straight line code with nearly minimal register need. This heuristic may be used to reorder the statements in a basic block before applying a global register allocation scheme like Graph Coloring. Experiments have shown that the new heuristic produces results which are about 30%...
متن کاملRegister Allocation via Weighted Graph Coloring (Technical Summary)
Register allocation by coloring an interference graph is a common technique. We introduce the weighted interference graph (WIG) which improves upon previous approaches in the following ways: (i) the cost of a coloring accurately models the cost of the register assignment, (ii) arbitrary register spills are handled naturally, as the coloring implicitly determines when and what registers to spill...
متن کاملThe Power of Belady?s Algorithm in Register Allocation for Long Basic Blocks
Optimization techniques such as loop-unrolling and trace-scheduling can result in long straight-line codes. It is, however, unclear how well the register allocation algorithms of current compilers perform on these codes. Compilers may well have been optimized for human written codes, which are likely to have short basic blocks. To evaluate how the state of the art compilers behave on long strai...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1993